home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 3.4 KB | 169 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: SLIcon.cpp
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef SLICON_H
- #include "SLIcon.h"
- #endif
-
- #ifndef PRICON_H
- #include "PRIcon.h"
- #endif
-
- #ifndef FWODEXCE_H
- #include "FWODExce.h"
- #endif
-
- #ifndef FWSTRMRW_H
- #include "FWStrmRW.h"
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment FWGraphics_Icon
- #endif
-
- // Creation
-
- FW_HIcon SL_API FW_PrivIcon_CreateFromPlatformIcon(
- FW_PlatformIcon hIcon,
- FW_PlatformError* error)
- {
- FW_ERR_TRY
- {
- return FW_NEW(FW_CPrivIconRep, (hIcon));
- }
- FW_ERR_CATCH
- return 0;
- }
-
- FW_HIcon SL_API FW_PrivIcon_CreateFromResource(
- FW_OResourceFile* resourceFile,
- FW_ResourceId resId,
- short size,
- FW_PlatformError* error)
- {
- FW_ERR_TRY
- {
- return FW_NEW(FW_CPrivIconRep, (resourceFile, resId, size));
- }
- FW_ERR_CATCH
- return 0;
- }
-
- FW_HIcon SL_API FW_PrivIcon_Copy(FW_HIcon icon, FW_PlatformError* error)
- {
- FW_ERR_TRY
- {
- return FW_NEW(FW_CPrivIconRep, (*icon));
- }
- FW_ERR_CATCH
- return 0;
- }
-
- // Reference counting
-
- void SL_API FW_PrivIcon_Acquire(FW_HIcon icon)
- {
- // No try block necessary - Do not throw
- icon->Acquire();
- }
-
- long SL_API FW_PrivIcon_GetRefCount(FW_HIcon icon)
- {
- // No try block necessary - Do not throw
- return icon->GetRefCount();
- }
-
- void SL_API FW_PrivIcon_Release(FW_HIcon icon)
- {
- // No try block necessary - Do not throw
- icon->Release();
- }
-
- // Comparison
-
- FW_Boolean SL_API FW_PrivIcon_IsEqual(FW_HIcon icon, FW_HIcon icon2)
- {
- // No try block necessary - Do not throw
- return icon->IsEqual(icon2);
- }
-
- // Get, Set, Adopt and Orphan
-
- FW_PlatformIcon SL_API FW_PrivIcon_GetPlatformIcon(FW_HIcon icon)
- {
- // No try block necessary - Do not throw
- return icon->GetPlatformIcon();
- }
-
- FW_PlatformIcon SL_API FW_PrivIcon_OrphanPlatformIcon(FW_HIcon icon)
- {
- // No try block necessary - Do not throw
- return icon->OrphanPlatformIcon();
- }
-
- FW_Boolean SL_API FW_PrivIcon_IsPlatformIconOrphan(FW_HIcon icon)
- {
- // No try block necessary - Do not throw
- return icon->IsPlatformIconOrphan();
- }
-
- FW_PlatformError SL_API FW_PrivIcon_SetPlatformIcon(FW_HIcon icon, FW_PlatformIcon newIcon)
- {
- // No try block necessary - Do not throw
- icon->SetPlatformIcon(newIcon);
- return FW_xNoError;
- }
-
- FW_PlatformError SL_API FW_PrivIcon_AdoptPlatformIcon(FW_HIcon icon, FW_PlatformIcon newIcon)
- {
- // No try block necessary - Do not throw
- icon->AdoptPlatformIcon(newIcon);
- return FW_xNoError;
- }
-
- // Size
-
- void SL_API FW_PrivIcon_GetIconSize(FW_HIcon icon, FW_SPoint& size)
- {
- // No try block necessary - Do not throw
- icon->GetIconSize(size);
- }
-
- void SL_API FW_PrivIcon_GetIconSizeGC(Environment* ev, FW_HIcon icon, FW_SGraphicContext& gc, FW_SPoint& size)
- {
- // No try block necessary - Do not throw
- icon->GetIconSize(ev, gc, size);
- }
-
- // Streaming
-
- FW_HIcon SL_API FW_PrivIcon_Read(FW_HReadableStream hStream, FW_PlatformError* error)
- {
- FW_ERR_TRY
- {
- FW_CReadableStream stream(hStream);
- return FW_NEW(FW_CPrivIconRep, (stream));
- }
- FW_ERR_CATCH
- return 0;
- }
-
- void SL_API FW_PrivIcon_Write(FW_HIcon icon, FW_HWritableStream hStream, FW_PlatformError* error)
- {
- FW_ERR_TRY
- {
- FW_CWritableStream stream(hStream);
- icon->Write(stream);
- }
- FW_ERR_CATCH
- }
-
-